using imitateMacQQ.WebApi.Domain.real_time.communication.Entity;
using imitateMacQQ.WebApi.Domain.real_time.communication.Interface;
using imitateMacQQ.WebApi.Domain.Request.utils;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace imitateMacQQ.WebApi.Api.Real_Time_communication;

[ApiController]
[Route("api/[controller]/[action]")]
public class CommunicationController : ControllerBase
{
    private readonly IDesign _design;

    public CommunicationController(IDesign design)
    {
        _design = design;
    }

    [Authorize]
    [HttpPost]
    public async Task<Request<GetPipeline[]>> GetCommunicationInfo(InfoAccount account)
    {
        return await _design.GetIngo(account);
    }

    [Authorize]
    [HttpPost]
    public async Task<Request<bool>> SendCommunication(SavePipeline message)
    {
        return await _design.SendMessageOfUser(message);
    }

    [Authorize]
    [HttpPost]
    public Request<bool> GetInfoResult(InfoAccount res)
    {
        return _design.GetInfoResult(res);
    }

    [Authorize]
    [HttpPost]
    public async Task<Request<DateTime>> GetTime(GetInfoTime dto)
    {
        return await _design.GetInfoEndTime(dto);
    }
}